package repository;

import java.io.Serializable;



/**
 * Represents a note to be played.  Contains information about octave, note and duration.
 * @author 0800542m
 *
 */
public class Note implements Serializable {

	private static final long serialVersionUID = -4939305011512360554L;

	private int octave;
	private int freq;
	private int duration;
	private boolean isRest;
	
	/**
	 * Constructor method for a Note, taking in three variables.
	 * @param o The octave the note is within, from -1 to 9.
	 * @param n The note itself.
	 * @param d The duration of the note in 32ths of a bar.
	 */
	public Note(int o,int n,int d, boolean r){
		octave = o;
		freq = n;
		duration = d;	
		isRest = r;
	}

	public int getOctave() {
		return octave;
	}

	public int getNote() {
		return freq;
	}

	public int getDuration() {
		return duration;
	}
	
	public boolean isRest(){
		return isRest;
	}
	
	//toString to allow testing.
	public String toString(){
		return String.format("O:%d N:%c D:%d", octave, freq, duration);
	}
	
}
